DragWindow
void DragWindow( theWindow, startPoint, limitRect ); Point startPoint ; current mouse position, in global coordinates Rect *limitRect ; area in which window can be dragged DragWindow draws a dotted-line rectangle the size of the window and moves it in response to the mouse. It retains control as long as the button is pressed.
When the button is released, the window is redrawn at its new location. The
window is then activated (unless is pressed while dragging).
theWindow identifies the window to be dragged. It is normally a WindowPtr obtained via FindWindow after a mouse-down occurs in the title bar of a window (the return value of FindWindow is inDrag). startPoint is a Point, in global coordinates. It is normally the where field of an EventRecord that indicated a mouse-down event in the drag region of the window.
limitRect identifies, in global screen coordinates, the limits within which the
user will be allowed to move the window.
Notes: This performs all actions needed in moving a window according to the
Macintosh user-interface guidelines. After a mouseDown event occurs, use
FindWindow to obtain the values for theWindow and thePoint , set a value for limitRect , and call this function - it does the rest.
If theWindow is inactive, this normally activates it, causing it to be moved
to the frontmost plane and highlighted. However, if the user presses
while dragging, the window will remain inactive (as when MoveWindow is called with behind = FALSE). If the mouse leaves the limitRect area, the window outline will vanish
until the mouse reenters the area. If the button is released while outside of
limitRect , the window is not moved. For instance, you will normally set
limitRect to enclose an area at least 4 pixels smaller (in each direction)
than the background desktop ( screenBits.bounds).
The Window Manager generates update events for any windows that need to
be redrawn.